﻿<%@ Control Language="C#" %>
<%@ Import Namespace="Hidistro.Entities" %>
<%@ Import Namespace="System" %>
<%@ Register TagPrefix="Hi" Namespace="Hidistro.UI.SaleSystem.Tags" Assembly="Hidistro.UI.SaleSystem.Tags" %>
<%--<div class="address_tab">--%>
    <asp:Repeater ID="rp_shippgaddress" runat="server">
        <ItemTemplate>
           <%-- <div class="list">
                <div class="inner ">
                    <div title="<%# RegionHelper.GetFullRegion(Convert.ToInt32(Eval("RegionId").ToString())," ") %>" (<%# Eval("ShipTo") %>收)" class="addr-hd">
                        <%# RegionHelper.GetFullRegion(Convert.ToInt32(Eval("RegionId").ToString())," ") %>（<span class="name"><%# Eval("ShipTo") %></span><span>
                            收）</span></div>
                    <div class="addr-bd" title='<%# Eval("Address")%>'>
                        <span class="street"><%# Eval("Address")%></span><span class="phone"><%# Eval("CellPhone")%></span><span
                            class="last">&nbsp;</span>
                    </div>
                </div>
                <em class="curmarker"></em>
                <input type="hidden" value='<%# Eval("ShippingId") %>' />
            </div>--%>
            <li class="ggboxl">
                    <div class="address_right_addressd_nav clearfix"><span><%--公司地址--%><%# Eval("AnotherAddress") %></span><span class="jbbbbb"><a class="mrdz" IsDefault="<%# Eval("IsDefault") %>" style="display:none;" href="javascript:void(0)">默认地址</a></span><i><a href="javascript:void(0)" class="del" shippingid="<%# Eval("ShippingId") %>"><img src="http://image.juseshop.com/images\/index/address_xx.png" /></a></i></div>
                    <div class="address_right_addressd_left clearfix">
                        <p><span>收货人：</span><em><%# Eval("ShipTo") %></em></em>
                        <p><span>所在地区：</span><em><%# RegionHelper.GetFullRegion(Convert.ToInt32(Eval("RegionId").ToString())," ") %></em></p>
                        <p><span>地址：</span><em><%# Eval("Address") %></em></p>
                        <p><span>手机：</span><em><%# Eval("CellPhone") %></em></p>
                        <p><span>邮编：</span><em><%# Eval("Zipcode") %></em></p>
                        <p class="address_right_addressd_leftss clearfix"><span>地址别名：</span><em><%# Eval("AnotherAddress") %></em></p>
                        <p class="address_right_addressd_leftsss clearfix"><a class="swmr" shippingid="<%# Eval("ShippingId") %>" href="javascript:void(0)" IsDefault="<%# Eval("IsDefault") %>" shippingid="<%# Eval("ShippingId") %>">设为默认</a><a class="bj"  shippingid="<%# Eval("ShippingId") %>" href="javascript:void(0)">编辑</a></p>
                    </div>
                </li>
        </ItemTemplate>
    </asp:Repeater>
<input type="hidden" id="hfcurshippingid" />
<script type="text/javascript">
    $(function () {
        $(".mrdz").each(function () {
            if ($(this).attr("IsDefault") == "True") {
                $(this).show();
            }
        });
        $(".swmr").each(function () {
            if ($(this).attr("IsDefault") == "True") {
                $(this).hide();
            }
        });
        $(".del").click(function () {
            if (confirm("您确定要删除吗?")) {
                var obj = $(this);
                var shippingid = $(this).attr("shippingid");
                $.ajax({
                    url: "/API/VshopProcess.ashx",
                    type: 'post',
                    dataType: 'json',
                    timeout: 10000,
                    data: {
                        action: "DelShippingAddress",
                        shippingid: shippingid
                    },
                    success: function (resultData) {
                        if (resultData.success) {
                            obj.parent().parent().parent().hide();
                        }
                        else {
                            alert("删除失败");
                        }
                    }
                });
            }
        }).css("cursor", "pointer");
        $(".swmr").click(function () {
            var obj = $(this);
            var shippingid = $(this).attr("shippingid");
            $.ajax({
                url: "/API/VshopProcess.ashx",
                type: 'post',
                dataType: 'json',
                timeout: 10000,
                data: {
                    action: "SetDefaultShippingAddress",
                    shippingid: shippingid
                },
                success: function (resultData) {
                    if (resultData.success) {
                        //alert("设置成功");
                        //if (window.location.search.indexOf("returnUrl=") == -1) {
                        //    location.href = "/JuseWeb/User/ReceivingAddress.aspx";
                        //    return false;
                        //}
                        //var returnURL = window.location.search.substr(window.location.search.indexOf("returnUrl=") + 10);
                        //if (returnURL == undefined) {
                        //    location.href = "/JuseWeb/User/ReceivingAddress.aspx";
                        //    return false;
                        //}
                        //location.href = decodeURIComponent(returnURL);
                        $(".swmr").show();
                        obj.hide();
                        $(".mrdz").hide();
                        obj.parent().parent().prev().find("a[class='mrdz']").show();
                    }
                    else {
                        alert("设置失败");//alert_h("设置失败");
                    }
                }
            });
        }).css("cursor", "pointer");
        //$(".ggbox").click(function () {
        //    $(".ggboxl").addClass("ggbox");
        //    $(".ggboxl").removeClass("ggboxl");
        //    $(this).addClass("ggboxl");
        //    $(this).removeClass("ggbox");
        //}).css("cursor", "pointer");

        //$(".ggbox").mouseover(function () {
        //    $(this).addClass("ggboxl");
        //}).mouseout(function () {
        //    $(this).removeClass("ggboxl");
        //});

        
    });
</script>
<%--</div>--%>